#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
    int n;
    int i;
    char a[10][4];
    int b[10], c[10];
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        scanf("%s", a[i]);
        scanf("%d", &b[i]);
        scanf("%d", &c[i]);
        if (b[i] < 15 || b[i]>20)
            printf("%s\n", a[i]);
        else if (c[i] < 50 || c[i]>70)
            printf("%s\n", a[i]);
    }
    return 0;
}
